//
//  YTKVC.m
//  Demo
//
//  Created by lx on 2019/4/2.
//  Copyright © 2019 mgz. All rights reserved.
//

#import "YTKVC.h"
#import "LoginApi.h"
#import <MGZTools.h>
#import "EncodeControl.h"
@interface YTKVC ()

@end

@implementation YTKVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:btn];
    btn.frame = CGRectMake(0, 0, 200, 45);
    btn.backgroundColor = [UIColor redColor];
    btn.center = self.view.center;
    [btn addTarget:self action:@selector(postNetwork) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)postNetwork{
    LoginApi *api = [[LoginApi alloc]init];
    [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        [MGZLogOutputWindow printLog:request.responseString];
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        NSDictionary *dic = [EncodeControl convertDataToDic:request.responseString];
        [MGZLogOutputWindow printLog:dic[@"msg"]];
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
